<div id="tag-cloud">
<ul>
<?php foreach ($tags as $tag): ?>
  <li>
  <?php $count = $tag->countPublishedPosts(); ?>
  <?php echo link_to(
                     $tag->getName() ? $tag->getName() : $tag->getHandle(), 
                     '@default?lang='.$sf_user->getLang().'&module='.$mode.'&action=tag&tag='.$tag->getHandle(), 
                     array(
                       'title' => $count,
                       'class' => 'cloud_'.floor(($count * 3 / $max) + 1),
                       )); ?>
  
  </li>
<?php endforeach; ?>
</ul>
</div>
